const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 20; i++) content.push({
        id: `id${i}`,
        code: `513200${i}`,
        name: `name${i}`,
        description: `description${i}`,
        rowVersion: 'rowVersion',
        options: ['update', 'abandon']
    });

    res.json({
        message: 'ok',
        payload: {
            content,
            totalElements: 20,
        }
    });
});

router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});

router.put('/:id', (req, res) => {
    res.json({
        message: '修改成功'
    });
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});

router.get('/export', (req, res) => {
    res.json({
        message: '导出成功',
        payload: 'Mock导出'
    });
});

module.exports = router;
